home *** CD-ROM | disk | FTP | other *** search
/ DOS Vuser Deluxe 2003 October / DOS Vuser Deluxe 2003 Oct - Disc 1.iso / SKIN / Le Crapouillot.wmz / Crapouillot.js < prev    next >
Text File  |  2002-02-02  |  5KB  |  237 lines

  1. var geckosState=2;
  2. var visState=0;
  3. var isOpen=false;
  4. var init2do=true;
  5. var vidIsFullscreen=false;
  6.  
  7. function init(){
  8.     pl.setColumnResizeMode(0, "Stretches");
  9.     pl.setColumnResizeMode(1, "AutoSizeData");
  10.     visState=theme.loadPreference("visState");
  11.     if (visState==0 || visState=="--") {
  12.     visState=1;
  13.     } else {
  14.     visState=0;
  15.     }
  16.     visOnOff();
  17.     geckosState=theme.loadPreference("geckosState");
  18.     if (geckosState=="--") {
  19.     geckosState=1;
  20.     } else {
  21.     geckosState=geckosState-1;
  22.     }
  23.     switchGeckos();
  24.     onPlayStateChange();
  25. }
  26. function init2(){
  27.     if(init2do) {
  28.         //this runs only when not in the skin select mode, and only once
  29.         init2do=false;
  30.         position_slider.visible=true;
  31.         position_sliderline.visible=true;
  32.     }
  33. }
  34.  
  35.  
  36. function switchGeckos(){
  37.     geckosState++;
  38.     printToDebug(geckosState);
  39.     if (geckosState==4) {
  40.         geckosState=0;
  41.     } else
  42.     if (geckosState==0) {
  43.         setHidden();
  44.     } else
  45.     if (geckosState==1) {
  46.         setNervous();
  47.     } else
  48.     if (geckosState==2) {
  49.         setCool();
  50.     } else
  51.     if (geckosState==3) {
  52.         setSteady();
  53.     }
  54. }
  55.  
  56. function setHidden(){
  57.         geckosState=0;
  58.         theme.closeView("walkinggeckos");
  59.         printToDebug("Geckos stay hidden for now");
  60.         geckoButton.upToolTip="Geckos stay hidden for now, Crapouillot stays quiet";
  61.         hideButton.down= "true";
  62.         nervousButton.down= "false";
  63.         coolButton.down= "false";
  64.         steadyButton.down= "false";
  65. }
  66.  
  67. function setNervous(){
  68.         geckosState=1;
  69.         theme.openView("walkinggeckos");
  70.         geckoButton.upToolTip="Geckos and Crapouillot are active";
  71.         hideButton.down= "false";
  72.         nervousButton.down= "true";
  73.         coolButton.down= "false";
  74.         steadyButton.down= "false";
  75. }
  76. function setCool(){
  77.         geckosState=2;
  78.         theme.openView("walkinggeckos");
  79.         geckoButton.upToolTip="Geckos are active, Crapouillot is cool";
  80.         hideButton.down= "false";
  81.         nervousButton.down= "false";
  82.         coolButton.down= "true";
  83.         steadyButton.down= "false";
  84. }
  85.  
  86. function setSteady() {
  87.         geckosState=3;
  88.         theme.closeView("walkinggeckos");
  89.         geckoButton.upToolTip="Geckos are hidden, Crapouillot is cool";
  90.         hideButton.down= "false";
  91.         nervousButton.down= "false";
  92.         coolButton.down= "false";
  93.         steadyButton.down= "true";
  94. }
  95.  
  96. function visOnOff(){
  97.     if (visState==0) {
  98.         visState=1;
  99.         effectsVis.visible=true;
  100.         metadata.top=173;
  101.         tracktime.top=161;
  102.         tracktime.foregroundColor="#BB8844";
  103.         position_slider.top=183;
  104.         position_sliderline.top=185;
  105.     } else {
  106.         visState=0;
  107.         effectsVis.visible=false;
  108.         metadata.top=114;
  109.         tracktime.top=102;
  110.         tracktime.foregroundColor="#330000";
  111.         position_slider.top=124;
  112.         position_sliderline.top=126;
  113.     }
  114. }
  115.  
  116. function PlayPause(){
  117.     if (player.playState==3) {
  118.         player.controls.pause();
  119.     } else {
  120.         player.controls.play();
  121.     }
  122. }
  123.  
  124.  
  125. function onPlayStateChange() {
  126.     vidIsPlaying = (player.OpenState == osMediaOpen) && (player.currentMedia.ImageSourceWidth>0);
  127.     vidIsPlaying ? openVidWindow() : noshowVideo();
  128.  
  129. }
  130.  
  131. function openVidWindow() {
  132.     theme.openview( 'videoView' );
  133.     gearStatusOff();
  134. }
  135.  
  136. function noshowVideo() {
  137.     vidIsPlaying = false;
  138.     gears.visible = true;
  139.     starStatus = 3;
  140.  
  141. }
  142.  
  143. function OnLoadVideo()
  144. {
  145.     SnapToVideo();
  146.  
  147. }
  148. // makes sure that the video stretches along with your resizing == this could be
  149. // done within the <video/> tags...
  150. function AllowResizeVideo()
  151. {
  152.     mediacenter.videoStretchToFit=true;
  153.     mediacenter.videoShrinkToFit=true; 
  154.     return;
  155. }
  156.  
  157. function exitFullmode(){
  158.     if (event.keyCode!=27) return;
  159.     if(vidIsFullscreen) ZoomVideo();
  160. }
  161.  
  162. // zooms your video window onClick
  163. function ZoomVideo()
  164. {
  165.     g_fUserHasSized = true;
  166.  
  167.     mediacenter.videoStretchToFit = false;
  168.     mediacenter.videoShrinkToFit = false;
  169.  
  170.     if( mediacenter.videoZoom < 51 )
  171.     {
  172.         mediacenter.videoZoom = 100;
  173.     }
  174.     else if( mediacenter.videoZoom < 101 )
  175.     {
  176.         mediacenter.videoZoom = 200;
  177.     }
  178.     else if( (mediacenter.videoZoom < 201) && !vidIsFullscreen )
  179.     {
  180.     mediacenter.videoStretchToFit = true;
  181.     VideoRgn.left=0;
  182.     VideoRgn.top=0;
  183.     view.maximize();
  184.     VideoRgn.width=view.width;
  185.     VideoRgn.height=view.height;
  186.     vidIsFullscreen=true;
  187.     position_sliderline.visible=false;
  188.     } 
  189.     else if( vidIsFullscreen) 
  190.     {
  191.         view.restore();
  192.         VideoRgn.left="27";
  193.         VideoRgn.top="9";
  194.         VideoRgn.width=view.width-37;
  195.         VideoRgn.height=view.height-36;
  196.  
  197.     vidIsFullscreen=false;
  198.     mediacenter.videoZoom = 201;
  199.     position_sliderline.visible=true;
  200.     }
  201.     else
  202.     {
  203.     mediacenter.videoZoom = 50;
  204.     }
  205.     SnapToVideo();
  206.  
  207. }
  208. // resizes the window to the video width & height
  209. function SnapToVideo()
  210. {
  211.     if (vidIsFullscreen) return;
  212.     if( (!g_fUserHasSized && mediacenter.videoStretchToFit) || !mediacenter.videoStretchToFit)
  213.     {
  214.         var zoom = mediacenter.videoStretchToFit ? 100 : mediacenter.videoZoom;
  215.         var x = (player.currentMedia.imageSourceWidth * (zoom / 100.0));
  216.         var y = (player.currentMedia.imageSourceHeight * (zoom / 100.0));
  217.  
  218.         g_fExpectingSizeChange = true;
  219.         view.width = x + 12;
  220.         view.height = y + 19;
  221.         g_fExpectingSizeChange = false;
  222.     }
  223.     else
  224.     {
  225.         view.height= player.currentMedia.imageSourceHeight + 44;
  226.         view.width= player.currentMedia.imageSourceWidth + 110;
  227.     }
  228.  
  229.     vidinfo.value = "Zoom: " + mediacenter.videoZoom + "%";
  230. }
  231.  
  232. function OnCloseVideo()
  233. {
  234.     video.close();
  235.  
  236. }
  237.